#!/bin/bash
# This is a qemu-ifup script for bridge.

# set your bridge name
switch=&{bridge}

if [ -n "$1" ]; then
    # create a TAP interface; qemu will handle it automatically.
    # start up the TAP interface
    ip link set $1 up promisc on
    echo "Adding $1 to $switch..."
    # add TAP interface to the bridge
    brctl addif ${switch} $1
    exit 0
else
    echo "Error: no interface specified"
    exit 1
fi
